package com.firstpro.domain;

import com.firstpro.domain.BaseDomain;

import javax.persistence.*;
import java.sql.Date;

/**
 * Created by Administrator on 2017/5/13.
 */
@Entity
@Table(name = "topic", schema = "firstprozhl", catalog = "")
public class TopicEntity extends BaseDomain {
    private int topicId;
    private String topicTitle;
    private Date creatTime;
    private Date lastPost;
    private Integer view;
    private Integer replies;
    private Integer digest;

    @Id
    @Column(name = "topic_id")
    public int getTopicId() {
        return topicId;
    }

    public void setTopicId(int topicId) {
        this.topicId = topicId;
    }

    @Basic
    @Column(name = "topic_title")
    public String getTopicTitle() {
        return topicTitle;
    }

    public void setTopicTitle(String topicTitle) {
        this.topicTitle = topicTitle;
    }

    @Basic
    @Column(name = "creat_time")
    public Date getCreatTime() {
        return creatTime;
    }

    public void setCreatTime(Date creatTime) {
        this.creatTime = creatTime;
    }

    @Basic
    @Column(name = "last_post")
    public Date getLastPost() {
        return lastPost;
    }

    public void setLastPost(Date lastPost) {
        this.lastPost = lastPost;
    }

    @Basic
    @Column(name = "view")
    public Integer getView() {
        return view;
    }

    public void setView(Integer view) {
        this.view = view;
    }

    @Basic
    @Column(name = "replies")
    public Integer getReplies() {
        return replies;
    }

    public void setReplies(Integer replies) {
        this.replies = replies;
    }

    @Basic
    @Column(name = "digest")
    public Integer getDigest() {
        return digest;
    }

    public void setDigest(Integer digest) {
        this.digest = digest;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TopicEntity that = (TopicEntity) o;

        if (topicId != that.topicId) return false;
        if (topicTitle != null ? !topicTitle.equals(that.topicTitle) : that.topicTitle != null) return false;
        if (creatTime != null ? !creatTime.equals(that.creatTime) : that.creatTime != null) return false;
        if (lastPost != null ? !lastPost.equals(that.lastPost) : that.lastPost != null) return false;
        if (view != null ? !view.equals(that.view) : that.view != null) return false;
        if (replies != null ? !replies.equals(that.replies) : that.replies != null) return false;
        if (digest != null ? !digest.equals(that.digest) : that.digest != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = topicId;
        result = 31 * result + (topicTitle != null ? topicTitle.hashCode() : 0);
        result = 31 * result + (creatTime != null ? creatTime.hashCode() : 0);
        result = 31 * result + (lastPost != null ? lastPost.hashCode() : 0);
        result = 31 * result + (view != null ? view.hashCode() : 0);
        result = 31 * result + (replies != null ? replies.hashCode() : 0);
        result = 31 * result + (digest != null ? digest.hashCode() : 0);
        return result;
    }
}
